//
// Created by xili on 2024/7/31 18:46.
// Go big or go home.
//
#include <iostream>

using namespace std;

class Solution {
public:
    string reverseVowels(string s) {
        int n = s.size();
        int left = 0;
        int right = n - 1;
        while (left < right) {
            while (left < n - 1 && !isYuan(s[left])) {
                left++;
            }
            while (right > 0 && !isYuan(s[right])) {
                right--;
            }
            if (left < right && isYuan(s[left]) && isYuan(s[right])) {
                swap(s[left++], s[right--]);
            }
        }
        return s;
    }

    bool isYuan(char s) {
        s = tolower(s);
        return s == 'a' || s == 'e' || s == 'i' || s == 'o' || s == 'u';
    }
};